/* 聊天容器 */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 650px;
  max-height: 450px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 聊天头部 */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  min-height: 50px;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.avatar-icon {
  font-size: 18px;
  color: white;
}

.chat-info h3 {
  margin: 0;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.status {
  color: #4ade80;
  font-size: 12px;
  font-weight: 500;
}

.chat-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.recall-last-btn {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.recall-last-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.5);
}

/* 消息容器 */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  min-height: 300px;
  position: relative;
}

/* 撤回提示 */
.recall-tip {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(34, 197, 94, 0.9);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  z-index: 10;
  animation: slideDown 0.3s ease-out;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.messages-container::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 消息样式 */
.message {
  display: flex;
  gap: 10px;
  max-width: 85%;
}

.message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-assistant {
  align-self: flex-start;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.message-user .message-avatar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message-assistant .message-avatar {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
  max-width: 100%;
  position: relative;
}

.message-user .message-bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 6px;
}

.message-assistant .message-bubble {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-bottom-left-radius: 6px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 消息操作按钮 */
.message-actions {
  position: absolute;
  top: -8px;
  right: -8px;
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  gap: 4px;
}

.message-bubble:hover .message-actions {
  opacity: 1;
}

.action-btn-small {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 10px;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.action-btn-small:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.edit-btn-small {
  background: rgba(59, 130, 246, 0.2);
}

.edit-btn-small:hover {
  background: rgba(59, 130, 246, 0.3);
}

.recall-btn-small {
  background: rgba(239, 68, 68, 0.2);
}

.recall-btn-small:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* 消息编辑 */
.message-edit-container {
  position: relative;
  width: 100%;
}

.message-edit-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.5);
  border-radius: 12px;
  padding: 8px 12px;
  color: white;
  font-size: 13px;
  line-height: 1.4;
  resize: none;
  outline: none;
  backdrop-filter: blur(10px);
}

.message-edit-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.edit-actions {
  position: absolute;
  top: -8px;
  right: -8px;
  display: flex;
  gap: 4px;
}

.edit-btn {
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.save-btn {
  background: rgba(34, 197, 94, 0.8);
  color: white;
}

.save-btn:hover {
  background: rgba(34, 197, 94, 1);
  transform: scale(1.1);
}

.cancel-btn {
  background: rgba(239, 68, 68, 0.8);
  color: white;
}

.cancel-btn:hover {
  background: rgba(239, 68, 68, 1);
  transform: scale(1.1);
}

/* 表情选择器 */
.emoji-picker {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(51, 65, 85, 0.95) 100%);
  border-radius: 16px;
  padding: 0;
  backdrop-filter: blur(25px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  z-index: 1000;
  animation: slideUp 0.3s ease-out;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(148, 163, 184, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  min-width: 320px;
  max-width: 400px;
  display: block !important;
}

.emoji-picker::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgba(30, 41, 59, 0.95);
}

.emoji-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.3);
  border-radius: 16px 16px 0 0;
}

.emoji-picker-title {
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.emoji-picker-close {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fca5a5;
  font-size: 14px;
  transition: all 0.2s ease;
}

.emoji-picker-close:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
  transform: scale(1.1);
}

.emoji-search {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.emoji-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 8px 16px;
  color: white;
  font-size: 13px;
  outline: none;
  backdrop-filter: blur(10px);
}

.emoji-search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.emoji-categories {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

.emoji-category-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.emoji-category-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.emoji-category-btn.active {
  color: white;
  border-bottom-color: rgba(59, 130, 246, 0.8);
  background: rgba(59, 130, 246, 0.1);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  padding: 16px;
  background: rgba(15, 23, 42, 0.2);
  border-radius: 0 0 16px 16px;
  max-height: 300px;
  overflow-y: auto;
}

.emoji-picker .emoji-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  color: #e2e8f0;
}

.emoji-picker .emoji-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.emoji-picker .emoji-btn:active {
  transform: scale(0.95);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* 输入区域表情按钮 */
.input-actions .emoji-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.input-actions .emoji-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.input-actions .emoji-btn.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(99, 102, 241, 0.3) 100%);
  border: 1px solid rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
}

.recall-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 12px;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.recall-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.recall-btn span {
  font-size: 14px;
  line-height: 1;
}

.message-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.message-user .message-time {
  text-align: right;
  justify-content: flex-end;
}

.message-status {
  color: #4ade80;
  font-size: 10px;
  font-weight: bold;
}

/* 加载动画 */
.message-bubble.loading {
  background: rgba(255, 255, 255, 0.1);
  min-width: 60px;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 输入区域 */
.input-container {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  min-height: 60px;
  position: relative;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.message-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.4;
  resize: none;
  max-height: 100px;
  min-height: 18px;
  padding: 6px 0;
}

.message-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.message-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.send-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 16px;
  padding: 6px 12px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  font-weight: 500;
  min-width: 50px;
}

.send-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .chat-container {
    border-radius: 0;
    height: 100vh;
    max-width: 100%;
    max-height: 100vh;
  }
  
  .message {
    max-width: 90%;
  }
  
  .input-wrapper {
    border-radius: 18px;
    padding: 5px 10px;
  }
  
  .send-btn {
    padding: 5px 10px;
    font-size: 11px;
    min-width: 45px;
  }
  
  .chat-header {
    padding: 10px 12px;
  }
  
  .messages-container {
    padding: 12px;
  }

  .menu-content {
    margin: 20px;
    min-width: auto;
    max-width: calc(100vw - 40px);
  }

  .menu-stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .emoji-picker {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: calc(100% + 8px);
    min-width: auto;
    transform: none;
  }

  .emoji-picker::before {
    display: none;
  }

  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    padding: 12px;
    max-height: 250px;
  }

  .emoji-picker .emoji-btn {
    min-width: 32px;
    min-height: 32px;
    font-size: 18px;
    padding: 8px;
  }

  .emoji-picker-header {
    padding: 12px 16px;
  }

  .emoji-picker-title {
    font-size: 13px;
  }

  /* 图片预览响应式 */
  .image-preview {
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
  }

  .preview-image {
    max-height: 150px;
  }

  .image-description-input {
    min-height: 50px;
    font-size: 12px;
  }

  /* 消息图片响应式 */
  .message-image-container {
    max-width: 250px;
  }

  .message-actions {
    opacity: 1;
    position: static;
    margin-top: 8px;
    justify-content: flex-end;
  }

  .action-btn-small {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .chat-header {
    padding: 8px 10px;
  }

  .chat-avatar {
    width: 32px;
    height: 32px;
  }

  .avatar-icon {
    font-size: 16px;
  }

  .chat-info h3 {
    font-size: 13px;
  }

  .messages-container {
    padding: 8px;
  }

  .message-bubble {
    padding: 8px 12px;
    font-size: 12px;
  }

  .input-container {
    padding: 8px 12px;
  }

  .input-wrapper {
    padding: 4px 8px;
  }

  .message-input {
    font-size: 12px;
  }

  .send-btn {
    padding: 4px 8px;
    font-size: 10px;
    min-width: 40px;
  }

  .emoji-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px;
    max-height: 200px;
  }

  .emoji-picker .emoji-btn {
    min-width: 28px;
    min-height: 28px;
    font-size: 16px;
    padding: 6px;
  }

  .emoji-picker-header {
    padding: 10px 12px;
  }
}

/* 动画效果 */
.chat-container {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 搜索栏 */
.search-container {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 8px 16px;
  color: white;
  font-size: 13px;
  outline: none;
  backdrop-filter: blur(10px);
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.clear-search-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 12px;
  transition: all 0.2s ease;
}

.clear-search-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* 菜单 */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.menu-content {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 16px;
  padding: 20px;
  min-width: 300px;
  max-width: 400px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-header h4 {
  margin: 0;
  color: white;
  font-size: 16px;
  font-weight: 600;
}

.close-menu-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 12px;
  transition: all 0.2s ease;
}

.close-menu-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.menu-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item span {
  color: white;
  font-size: 12px;
  font-weight: 500;
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  backdrop-filter: blur(10px);
}

.menu-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.menu-btn.danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.menu-btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
}

/* 高亮搜索结果 */
.message-bubble.highlight {
  background: rgba(255, 193, 7, 0.2) !important;
  border: 1px solid rgba(255, 193, 7, 0.5) !important;
}

/* 性能优化 */
.chat-container {
  will-change: transform;
  contain: layout style paint;
}

.message-bubble {
  contain: layout style;
}

.messages-container {
  contain: layout style;
  will-change: scroll-position;
}

/* 无障碍优化 */
.action-btn:focus,
.send-btn:focus,
.recall-btn:focus,
.edit-btn:focus,
.emoji-btn:focus {
  outline: 2px solid rgba(59, 130, 246, 0.8);
  outline-offset: 2px;
}

.message-input:focus,
.search-input:focus,
.message-edit-input:focus {
  outline: 2px solid rgba(59, 130, 246, 0.8);
  outline-offset: 2px;
}

/* 深色模式优化 */
@media (prefers-color-scheme: dark) {
  .chat-container {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  .chat-container,
  .message,
  .recall-tip,
  .emoji-picker,
  .menu-content {
    animation: none;
  }

  .action-btn:hover,
  .send-btn:hover,
  .recall-btn:hover,
  .edit-btn:hover,
  .emoji-btn:hover {
    transform: none;
  }
}

/* 图片预览 */
.image-preview {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(51, 65, 85, 0.95) 100%);
  border-radius: 16px;
  padding: 0;
  backdrop-filter: blur(25px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  z-index: 1000;
  animation: slideUp 0.3s ease-out;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(148, 163, 184, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  max-width: 400px;
}

.image-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.3);
  border-radius: 16px 16px 0 0;
}

.image-preview-header span {
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 600;
}

.image-preview-close {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fca5a5;
  font-size: 12px;
  transition: all 0.2s ease;
}

.image-preview-close:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
  transform: scale(1.1);
}

.image-preview-content {
  padding: 16px;
  background: rgba(15, 23, 42, 0.2);
  border-radius: 0 0 16px 16px;
}

.preview-image {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 12px;
}

.image-description-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  font-size: 13px;
  line-height: 1.4;
  resize: none;
  outline: none;
  margin-bottom: 12px;
  min-height: 60px;
}

.image-description-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.send-image-btn {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.send-image-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 消息图片 */
.message-image-container {
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
  max-width: 300px;
}

.message-image {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.message-image:hover {
  transform: scale(1.02);
}

/* 编辑图片预览 */
.editing-image-preview {
  position: relative;
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  max-width: 200px;
}

.editing-image {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
}

.remove-editing-image-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(239, 68, 68, 0.8);
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 10px;
  transition: all 0.2s ease;
}

.remove-editing-image-btn:hover {
  background: rgba(239, 68, 68, 1);
  transform: scale(1.1);
}

/* 图片模态框 */
.image-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

.image-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 18px;
  transition: all 0.2s ease;
  z-index: 10;
}

.image-modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.image-modal-image {
  width: 100%;
  height: auto;
  max-height: 90vh;
  object-fit: contain;
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 语音功能样式 */
.action-btn.speaking {
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  animation: pulse 1.5s infinite;
}

.action-btn.active {
  background: rgba(34, 197, 94, 0.3);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.5);
}

/* 消息点击转语音样式 */
.message.clickable {
  cursor: pointer;
  transition: all 0.3s ease;
}

.message.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.message.clickable .message-bubble {
  position: relative;
}

.message.clickable .message-bubble::after {
  content: '🔊';
  position: absolute;
  top: -8px;
  right: -8px;
  background: rgba(102, 126, 234, 0.9);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.message.clickable:hover .message-bubble::after {
  opacity: 1;
}

/* 正在播放的消息样式 */
.message.speaking {
  animation: speakingPulse 1.5s infinite;
}

.message.speaking .message-bubble {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
  border: 2px solid rgba(102, 126, 234, 0.5);
}

@keyframes speakingPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

/* 语音功能说明样式 */
.voice-features {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.voice-features h5 {
  margin: 0 0 12px 0;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 12px;
}

.feature-item:last-child {
  margin-bottom: 0;
}

.feature-icon {
  font-size: 14px;
  min-width: 20px;
}

.feature-text {
  flex: 1;
}

.feature-status {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
}

.feature-status.active {
  background: rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.feature-status.inactive {
  background: rgba(156, 163, 175, 0.3);
  color: #d1d5db;
}

/* 语音状态指示器样式 */
.speech-status {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-bottom: 12px;
}

.speech-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: slideInDown 0.3s ease-out;
}

.speech-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: blink 1.5s infinite;
}

.speech-text {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
}

.speech-stop-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.2s ease;
}

.speech-stop-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* 语音设置样式 */
.voice-settings {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.voice-settings h5 {
  margin: 0 0 12px 0;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.voice-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.voice-control-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-size: 12px;
}

.voice-control-item span:first-child {
  min-width: 40px;
  font-weight: 500;
}

.voice-slider {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
}

.voice-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #667eea;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.voice-slider::-webkit-slider-thumb:hover {
  background: #5a67d8;
  transform: scale(1.1);
}

.voice-select {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #ffffff;
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
}

.voice-select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.voice-select option {
  background: #1a1a2e;
  color: #ffffff;
}

/* 响应式语音设置 */
@media (max-width: 768px) {
  .voice-controls {
    gap: 8px;
  }
  
  .voice-control-item {
    font-size: 11px;
  }
  
  .voice-slider {
    height: 3px;
  }
  
  .voice-slider::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 480px) {
  .voice-settings {
    padding: 12px;
  }
  
  .voice-control-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .voice-control-item span:first-child {
    min-width: auto;
  }
}

/* 错误边界样式 */
.error-boundary {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 12px;
}

.error-content {
  text-align: center;
  color: white;
  padding: 20px;
}

.error-content h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: #fca5a5;
}

.error-content p {
  margin: 0 0 15px 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.error-retry-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.error-retry-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Markdown内容样式 */
.markdown-content {
  color: inherit;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* 标题样式 */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.3;
}

.markdown-content h1 {
  font-size: 1.5em;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 8px;
}

.markdown-content h2 {
  font-size: 1.3em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
}

.markdown-content h3 {
  font-size: 1.1em;
}

.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  font-size: 1em;
}

/* 段落样式 */
.markdown-content p {
  margin: 8px 0;
  line-height: 1.6;
}

/* 代码块样式 */
.markdown-content pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  overflow-x: auto;
  backdrop-filter: blur(10px);
}

.markdown-content pre code {
  background: transparent;
  color: #e2e8f0;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  line-height: 1.4;
}

/* 行内代码样式 */
.markdown-content code {
  background: rgba(255, 255, 255, 0.1);
  color: #fbbf24;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 列表样式 */
.markdown-content ul,
.markdown-content ol {
  margin: 8px 0;
  padding-left: 24px;
}

.markdown-content li {
  margin: 4px 0;
  line-height: 1.5;
}

.markdown-content ul li {
  list-style-type: disc;
}

.markdown-content ol li {
  list-style-type: decimal;
}

/* 引用块样式 */
.markdown-content blockquote {
  background: rgba(59, 130, 246, 0.1);
  border-left: 4px solid #3b82f6;
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

.markdown-content blockquote p {
  margin: 0;
  color: #93c5fd;
}

/* 表格样式 */
.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.markdown-content th,
.markdown-content td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown-content th {
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
  color: #ffffff;
}

.markdown-content td {
  color: #e2e8f0;
}

.markdown-content tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* 链接样式 */
.markdown-content a {
  color: #60a5fa;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.markdown-content a:hover {
  color: #93c5fd;
  border-bottom-color: #93c5fd;
}

/* 强调样式 */
.markdown-content strong {
  font-weight: 600;
  color: #ffffff;
}

.markdown-content em {
  font-style: italic;
  color: #cbd5e1;
}

/* 分割线样式 */
.markdown-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  margin: 16px 0;
}

/* 代码高亮 */
.markdown-content .hljs {
  background: transparent;
}

/* 任务列表样式 */
.markdown-content input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
}

/* 图片样式 */
.markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .markdown-content h1 {
    font-size: 1.3em;
  }
  
  .markdown-content h2 {
    font-size: 1.2em;
  }
  
  .markdown-content pre {
    padding: 8px;
    font-size: 0.85em;
  }
  
  .markdown-content table {
    font-size: 0.9em;
  }
  
  .markdown-content th,
  .markdown-content td {
    padding: 6px 8px;
  }
}

/* 深色主题适配 */
@media (prefers-color-scheme: dark) {
  .markdown-content {
    color: #e2e8f0;
  }
  
  .markdown-content code {
    background: rgba(0, 0, 0, 0.4);
    color: #fbbf24;
  }
  
  .markdown-content pre {
    background: rgba(0, 0, 0, 0.5);
  }
}

/* 动画效果 */
.markdown-content {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 表情分类选择器 */
